#!/usr/bin/python3

import json
import requests
from setting import access_token


def message(msg):
    url = f'https://oapi.dingtalk.com/robot/send?access_token={access_token}'
    pagrem = {
        "msgtype": "text",
        "text": {
            "content": msg
        },
        "at": {
            "atMobiles": [
                "13564157050"  # 需要填写自己的手机号，钉钉通过手机号@对应人
            ],
            "isAtAll": False  # 是否@所有人，默认否
        }
    }
    headers = {
        'Content-Type': 'application/json'
    }
    requests.post(url, data=json.dumps(pagrem), headers=headers)


